package com.beone.smart.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RouteConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("user-center", router -> router
                        .path("/user-center/**")
                        .filters(filter -> filter)
                        .uri("lb://user-center")
                ).route("report-center", router -> router
                        .path("/report-center/**")
                        .filters(filter -> filter)
                        .uri("lb://report-center")
                )
                .build();
    }
    //http://localhost:12012/user-center/user_info/test   转发到了user-center服务
}
